package apitest

import (
	"fmt"
	"log"

	"github.com/tencent-connect/botgo/dto"
	"github.com/tencent-connect/botgo/openapi"
)

func Members(api openapi.OpenAPI) {
	members, err := api.GuildMembers(
		ctx, testGuildID, &dto.GuildMembersPager{
			After: "0",
			Limit: "10",
		},
	)
	if err != nil {
		panic(err)
	}
	for _, member := range members {
		log.Printf("user: %+v", member.User.Username)
		log.Printf("roles: %+v", member.Roles)
		userId := member.User.ID
		fmt.Println(userId)
	}

}
func Message(api openapi.OpenAPI) {
	// 先拉取3条消息
	messages, err := api.Messages(
		ctx, testChannelID, &dto.MessagesPager{
			Limit: "3",
		},
	)
	if err != nil {
		log.Println(err)
	}
	index := make(map[int]string)
	for i, message := range messages {
		index[i] = message.ID
		log.Println(message.ID, message.Author.Username, message.Timestamp)
	}

}
